/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyivtbmaterped")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyivtbmaterped.findAll", query = "SELECT p FROM Pyivtbmaterped p"),
    @NamedQuery(name = "Pyivtbmaterped.findByPyivtbmaterpedid", query = "SELECT p FROM Pyivtbmaterped p WHERE p.pyivtbmaterpedid = :pyivtbmaterpedid"),
    @NamedQuery(name = "Pyivtbmaterped.findByProducto", query = "SELECT p FROM Pyivtbmaterped p WHERE p.producto = :producto"),
    @NamedQuery(name = "Pyivtbmaterped.findByDescripcion", query = "SELECT p FROM Pyivtbmaterped p WHERE p.descripcion = :descripcion"),
    @NamedQuery(name = "Pyivtbmaterped.findByCantidad", query = "SELECT p FROM Pyivtbmaterped p WHERE p.cantidad = :cantidad"),
    @NamedQuery(name = "Pyivtbmaterped.findByCostounitario", query = "SELECT p FROM Pyivtbmaterped p WHERE p.costounitario = :costounitario"),
    @NamedQuery(name = "Pyivtbmaterped.findByFecharegistro", query = "SELECT p FROM Pyivtbmaterped p WHERE p.fecharegistro = :fecharegistro"),
    @NamedQuery(name = "Pyivtbmaterped.findByPedidonum", query = "SELECT p FROM Pyivtbmaterped p WHERE p.pedidonum = :pedidonum"),
    @NamedQuery(name = "Pyivtbmaterped.findByObservaciones", query = "SELECT p FROM Pyivtbmaterped p WHERE p.observaciones = :observaciones")})
public class Pyivtbmaterped implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyivtbmaterpedid")
    private Integer pyivtbmaterpedid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "producto")
    private int producto;
    @Size(max = 50)
    @Column(name = "descripcion")
    private String descripcion;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cantidad")
    private int cantidad;
    @Basic(optional = false)
    @NotNull
    @Column(name = "costounitario")
    private double costounitario;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecharegistro")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecharegistro;
    @Size(max = 6)
    @Column(name = "pedidonum")
    private String pedidonum;
    @Size(max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyivtbmaterpedid")
    private Collection<Pyivtbtrasutiles> pyivtbtrasutilesCollection;

    public Pyivtbmaterped() {
    }

    public Pyivtbmaterped(Integer pyivtbmaterpedid) {
        this.pyivtbmaterpedid = pyivtbmaterpedid;
    }

    public Pyivtbmaterped(Integer pyivtbmaterpedid, int producto, int cantidad, double costounitario, Date fecharegistro) {
        this.pyivtbmaterpedid = pyivtbmaterpedid;
        this.producto = producto;
        this.cantidad = cantidad;
        this.costounitario = costounitario;
        this.fecharegistro = fecharegistro;
    }

    public Integer getPyivtbmaterpedid() {
        return pyivtbmaterpedid;
    }

    public void setPyivtbmaterpedid(Integer pyivtbmaterpedid) {
        this.pyivtbmaterpedid = pyivtbmaterpedid;
    }

    public int getProducto() {
        return producto;
    }

    public void setProducto(int producto) {
        this.producto = producto;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public int getCantidad() {
        return cantidad;
    }

    public void setCantidad(int cantidad) {
        this.cantidad = cantidad;
    }

    public double getCostounitario() {
        return costounitario;
    }

    public void setCostounitario(double costounitario) {
        this.costounitario = costounitario;
    }

    public Date getFecharegistro() {
        return fecharegistro;
    }

    public void setFecharegistro(Date fecharegistro) {
        this.fecharegistro = fecharegistro;
    }

    public String getPedidonum() {
        return pedidonum;
    }

    public void setPedidonum(String pedidonum) {
        this.pedidonum = pedidonum;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    @XmlTransient
    public Collection<Pyivtbtrasutiles> getPyivtbtrasutilesCollection() {
        return pyivtbtrasutilesCollection;
    }

    public void setPyivtbtrasutilesCollection(Collection<Pyivtbtrasutiles> pyivtbtrasutilesCollection) {
        this.pyivtbtrasutilesCollection = pyivtbtrasutilesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyivtbmaterpedid != null ? pyivtbmaterpedid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyivtbmaterped)) {
            return false;
        }
        Pyivtbmaterped other = (Pyivtbmaterped) object;
        if ((this.pyivtbmaterpedid == null && other.pyivtbmaterpedid != null) || (this.pyivtbmaterpedid != null && !this.pyivtbmaterpedid.equals(other.pyivtbmaterpedid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyivtbmaterped[ pyivtbmaterpedid=" + pyivtbmaterpedid + " ]";
    }
    
}
